﻿namespace Home.Security.Authentication.Repository
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Runtime.Serialization;
    using System.Text;
    using System.Threading.Tasks;
    using Home.Data;

    internal class ApplicationUserEntity : Entity
    {
        private IDictionary<string, string> snsProperties;

        [DataMember]
        public string Key { get; set; }

        [DataMember]
        public AuthenticationType AuthenticationType { get; set; }

        [DataMember]
        public byte[] Photo { get; set; }

        public IDictionary<string, string> SnsProperties
        {
            get
            {
                if (this.snsProperties == null)
                {
                    this.snsProperties = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
                }

                return this.snsProperties;
            }
            set { this.snsProperties = value; }
        }

        [DataMember]
        public string SnsPropertiesString
        {
            get { return this.snsProperties.ToRepositoryProperties(); }
            set { this.snsProperties = value.ToEntityProperties(); }
        }
    }
}
